import { RouterKeys } from '@/router/config'
import { useLocation } from 'react-router-dom'

/**
 *  获取对应菜单的key
 * @returns 返回对应菜单key
 */
const usePathKey = () => {
    const location = useLocation()
    const key: RouterKeys = location.pathname.split('/')[1] as RouterKeys
    return key
}

export default usePathKey
